using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Supertris
{
    class Block
    {
        public Texture2D texture;
        public Color color;
        public bool cleared;
        int delay;

        public Block(Texture2D initTexture, Color initColor)
        {
            texture = initTexture;
            color = initColor;
        }

        public Block(Block copy)
        {
            texture = copy.texture;
            color = copy.color;
        }

        public void ClearBegin(int setDelay)
        {
            delay = setDelay;
        }

        public void ClearUpdate()
        {
            if (delay > 0)
            {
                delay--;
                if (delay == 0)
                    color = Color.White;
            }
            else
            {
                if (color.A >= 16)
                    color = new Color(color.R, color.G, color.B, (byte)(color.A - 16));
                else
                {
                    color = new Color(color.R, color.G, color.B, 0);
                    cleared = true;
                }
            }
        }
    }
}
